<?php
/**
 * XuYuan Project
 *
 * @package	XueYuan 
 * @author	Jiuchi Team
 * @since	Version 1.0.0
 * @filesource
 */
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * Login view
 * @author Wayne Yu
 */
?>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
    <?php $this->load->view('common/head');?>
	<!-- Page special css -->
    <link rel="stylesheet" type="text/css" href="/assets/css/index.css">
    <link rel="stylesheet" type="text/css" href="/assets/css/mycenter.css">
    <link rel="stylesheet" type="text/css" href="/assets/css/mycircle.css">
    <link rel="stylesheet" type="text/css" href="/assets/css/jquery.fancybox.css">
</head>
<body>
    <div class="navigation">
        <?php $this->load->view('common/navigation');?> 
    </div>
    <div class="wrapper">
        <div class="main-content">
            <div class="main-content-inner">
                <div class="home-list">
                    <div class="home-list-title">
                        <span>和 <?php echo $senderName?> 的私信</span>
                        <span class="pointer fr" onclick="window.location = '<?php echo site_url('home/letter')?>'" style="font-weight: normal;color: #999;">&lt&lt&nbsp返回上一级</span>
                    </div>
                    <div class="home-list-content clearfix">
                        <div class="home-list-content clearfix">
                            <form action="<?php echo site_url('mycenter/sendLetterPost/'.$senderId)?>" class="form-form" method="post">
                                <div class="content-topic-create clear">
                                    <div class="topic-create-title" style="margin: 0;">
                                        回复
                                    </div>
                                    <div class="edit-frame">
                                        <input type="hidden" name="source_id" value="<?php echo $lid?>"/>
                                        <textarea id="my-editor" name="content" style="resize:none; width: 550px;min-height: 18px;" maxlength="280" style="overflow: visible;"></textarea>
                                        <button class="right-btn-decoration btn-blue" style="display: inline-block;float: none;" type="submit">发送</button>            
                                    </div>   
                                </div>
                                
                            </form>
                            <ul id="cirTopicsMore">
                                <li class="topic-item">
                                    <div class="rep">
                                        <div class="rep-header clearfix">
                                            <div class="rep-avatar">
                                                <a target="_blank" href="#" class="headportrait"></a>
                                            </div>
                                            <div class="rep-note" style="line-height: 18px;">
                                                <div>
                                                <span class="rep-auth-src name"></span>:&nbsp</div>
                                                <div class="clearfix" style="width: 572px;">
                                                    <div class="date" style="float: left;">2015-1-1 12:00</div>
                                                    <div class="fr">
                                                        <a class="link-del pointer" onclick="delLetter(this);">删除</a>
                                                        <div class="letter_id" style="display: none;"></div>
                                                    </div>
                                                </div>                                                     
                                            </div>
                                        </div>
                                        <div class="rep-content-wrapper clearfix" >
                                            <div class="rep-content" style="padding: 0">
                                                <div class="rep-comment content"></div>
                                            </div>
                                        </div>
                                    </div>
                                </li>
                                <a href="javascript:;" class="btn-white btn-more btn-more-topics">查看更多</a>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<div class="footer">
    <?php $this->load->view('common/footer');?>
</div>
<script type="text/javascript" src="/assets/js/jquery.more.js"></script>
<script>
$(document).ready(function() {
    $('#cirTopicsMore').more({
        'address'   :   '<?php echo site_url('mycenter/getUserLetter/'.$senderId)?>',
        'template'  :   '.topic-item',
        'trigger'   :   '.btn-more-topics',
    });

    $(".link-rep").fancybox({
        href:"<?php echo site_url('mycenter/sendLetter/'.$senderId)?>",
        minWidth:500,
        scrolling: 'auto',
        padding:5,
        afterClose:function () {
             window.location.reload();
        },
    });

});
function delLetter(ele)
{	
    var ele=$(ele);	
    var a=confirm("你确定要删除这条信息么？删除之后将无法回复。");
    if(a==true)
    {
        $.ajax({
            type: 'post',
            url: '<?php echo site_url('mycenter/delLetter')?>',
            data: {
                letter_id : ele.parent().children().last().text(),          
            },
            dataType: 'json',
            success: function(data) {
                if (data.StatusCode == 200) {
                    alert("删除成功");
                    ele.parent().parent().parent().parent().parent().parent().hide();
                } else if (data.StatusCode == 300) {
                    alert("删除失败");
                }
            }
        });
    }
    else{
    }
}  
</script>

</body>
</html>

